namespace Rhino.net {
    public class Token {
        private Token(int value) {
            _value = value;
        }

        public override int GetHashCode() {
            return _type.GetHashCode();
        }

        public override bool Equals(object obj) {
            if (this == obj) return true;
            Token token = obj as Token;
            if (token == null) return false;
            if (!Equals(_type, token._type)) return false;
            return true;
        }

        public Token(Token type, string value) {
            _type = type;
            _stringValue = value;
        }

        public Token Type {
            get { return _type == null ? this : _type; }
        }

        public string Value {
            get { return _stringValue; }
        }

        public static Token SPACE = new Token(_SPACE_);
        public static Token NEWLINE = new Token(_NEW_LINE_);
        public static Token ERROR = new Token(_ERROR_);
        public static Token EOF = new Token(_EOF_);
        public static Token IDENTIFIER = new Token(_STRING_);
        public static Token KEYWORD = new Token(_KEYWORD_);
        public static Token unicode_IDENTIFIER = new Token(_UNICODE_IDENTIFIER);

        private const int _SPACE_ = 0;
        private const int _NEW_LINE_ = 1;
        private const int _ERROR_ = 2;
        private const int _EOF_ = 3;
        private const int _STRING_ = 4;
        private const int _KEYWORD_ = 5;
        private const int _UNICODE_IDENTIFIER = 6;


        private int _value;
        private string _stringValue = string.Empty;
        private Token _type;
    }
}